package com.power.sifa.info.model;


import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
*  法律条文实体类
*/

@Entity
@ApiModel(value="法律条文")
@Data
@Table(name="Law_provision",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Law_provision.Law_provisionPK.class) 用于复合组件
public class Law_provision extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "编码")
    private String id;

    @ApiModelProperty(value = "类别")
    private Integer type;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "正文")
    private String content;

    @ApiModelProperty(value = "引用法律编码")
    private String docid;

    @ApiModelProperty(value = "引用上级条文编码")
    private String parentid;

    @ApiModelProperty(value = "分词字段")
    private String conwords;


    @ApiModelProperty(value = "向量字段")
    private String convector;




    /**
     *  类别文本
     */
    @Transient
    @FieldEnumText(eum="Tp_provision", valuefield="type")
    private String type_text;


    @Override
    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("type_text", this.type_text);
        map.put("type", this.getType());
        map.put("title", this.getTitle());
        map.put("content", this.getContent());
        map.put("docid", this.getDocid());
        map.put("conwords", this.getConwords());
        map.put("convector", this.getConvector());

        return map;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public void setId(Serializable id) {
        this.id = (String) id;
    }

    @Override
    public Serializable getPrimaryKey() {
        return id;
        // return new Law_provisionPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    @Override
    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Law_provisionPK pk = (Law_provisionPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}